-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toml #30
Conversation
UPDATE: I am now using the command to generate a |
purs/src/Plasma/Config/TOML.purs
Outdated
toTomlValue = show >>> withQuotes | ||
|
||
instance tomlValueMaybe :: TomlValue a => TomlValue (Maybe a) where | ||
toTomlValue = maybe (withQuotes mempty) toTomlValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think doing toTomlValue = maybe (toTomlValue "") toTomlValue
is nicer as it's much clear what we are using in case we have Nothing value.
In general I think Maybe a
shuold have no TomlValue this instance as the TOML itself is not allowing NULL value, when there is no value the key should just be omitted, and using "" for Nothing might make it hard to parse the file. But if we are planning to use this just for this particular case and it works then it's fine to leave this instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the interest of using this for this particular case, I'm not worried about the Maybe
. If you look at what get's generated by plasmad init
this is the behaviour we want.
getPlasmaContractAddress (FromChanterelleArtifactFile provider fp) | ||
Just addr -> case mkHexString addr >>= mkAddress of | ||
Nothing -> liftEffect $ throw ("Error parsing PLASMA_ADDRESS: " <> show addr) | ||
Just addr' -> getPlasmaContractAddress (AddressLiteral addr') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing AddressLiteral
to getPlasmaContractAddress
is besically no op why not just do that log here and pure addr'
, and remove the AddressSource
data type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will decide whether or not to do this after we have a more standard setup script. My hope is that we can somehow do a fresh contract deployment / cliquebait for a test suite, but I also want to be able to run it from an existing deployment.
I did it yesterday for a reason I can't recall right now, but will only change it if I'm sure I don't want it. It works for now
Great, I'll have to update the docker image in order for it to not confuse things, but this should be really easy. We'll also have to change the |
@safareli I'm going to dismiss a lot of these comments regarding adding the quotes. I'm less interested in making sense of the toml related parts and more interested in generating the example at the top of this file, which would require putting quotes around everything including ints and bools. I don't want to deal with figuring out what is accepted by the plasma program right now |
Passed CI |
fixes #19
It doesn't fix this directly, but we now have the ability to write the toml file, or read from the plasma config from the environment. Using
sed
to parse the toml file for values, this means we can also read the toml file. I didn't want to write a custom parser for this.